﻿using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using DevExpress.Utils;
using DevExpress.XtraPrinting;

namespace Project_Udrinkwater.PagesAdmin
{
    public partial class Showsalary : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
    //          void Export(bool saveAs) {
    //    //PVG_ExportSalary.OptionsPrint.PrintHeadersOnEveryPage =  true;
    //    PVG_ExportSalary.OptionsPrint.PrintFilterHeaders = DefaultBoolean.True;
    //    PVG_ExportSalary.OptionsPrint.PrintColumnHeaders = DefaultBoolean.True;
    //    PVG_ExportSalary.OptionsPrint.PrintRowHeaders = DefaultBoolean.True;
    //    PVG_ExportSalary.OptionsPrint.PrintDataHeaders = DefaultBoolean.True;

    //    string fileName = "PivotGrid";
    //    switch(listExportFormat.SelectedIndex) {
    //        case 0:
    //            PVG_ExportSalary.ExportPdfToResponse(fileName, saveAs);
    //            break;
    //        case 1:
    //            PVG_ExportSalary.ExportXlsToResponse(fileName, saveAs);
    //            break;
    //        case 2:
    //            PVG_ExportSalary.ExportMhtToResponse(fileName, "utf-8", "ASPxPivotGrid Printing Sample", true, saveAs);
    //            break;
    //        case 3:
    //            PVG_ExportSalary.ExportRtfToResponse(fileName, saveAs);
    //            break;
    //        case 4:
    //            PVG_ExportSalary.ExportTextToResponse(fileName, saveAs);
    //            break;
    //        case 5:
    //            PVG_ExportSalary.ExportHtmlToResponse(fileName, "utf-8", "ASPxPivotGrid Printing Sample", true, saveAs);
    //            break;
    //    }
    //}
        }

        protected void Export_XlsPrivot_Click(object sender, EventArgs e)
        {
            PVG_ExportSalary.ExportXlsToResponse("PrivotGrid",true);
        }

        protected void Export_PdfPrivot_Click(object sender, EventArgs e)
        {
            //PrintableComponentLink link = new PrintableComponentLink(new PrintingSystem());
            //link.Component = PVG_ExportSalary;

            //PageHeaderArea headerArea;
            //PageHeaderFooter header;

            //headerArea = new DevExpress.XtraPrinting.PageHeaderArea();

            //headerArea.Content.Add("This is a test");
            //headerArea.LineAlignment = DevExpress.XtraPrinting.BrickAlignment.Near;

            //header = new DevExpress.XtraPrinting.PageHeaderFooter(headerArea, null);
            //link.PageHeaderFooter = header;
           // PVG_ExportSalary.OptionsPrint.GetPrintHeaders()
            PVG_ExportSalary.ExportPdfToResponse("PrivotGrid", true);
        }

        protected void PVG_ExportSalary_CustomExportCell(object sender, DevExpress.Web.ASPxPivotGrid.Export.WebCustomExportCellEventArgs e)
        {
            
            e.Appearance.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Center;
            e.Appearance.Font = new Font("Angsana New", 16, FontStyle.Regular);
        }
       
    }
}